using RuoVea.ExSugar.Filters.Domain;

namespace RuoVea.ExSugar.Entity;

/// <summary>
/// 框架实体基类
/// </summary>
public abstract class EntityBase : EntityBaseId, IDeletedFilter
{
    /// <summary>
    /// 创建时间
    /// </summary>
    [SugarColumn(ColumnDescription = "创建时间", IsOnlyIgnoreUpdate = true)]
    public virtual DateTime? CreateTime { get; set; }

    /// <summary>
    /// 修改时间
    /// </summary>
    [SugarColumn(ColumnDescription = "修改时间", IsOnlyIgnoreInsert = true)]
    public virtual DateTime? ModifyTime { get; set; }

    /// <summary>
    /// 创建者Id
    /// </summary>
    [SugarColumn(ColumnDescription = "创建者Id", IsOnlyIgnoreUpdate = true)]
    public virtual long? Creator { get; set; }

    /// <summary>
    /// 修改人
    /// </summary>
    [SugarColumn(ColumnDescription = "修改者Id")]
    public virtual long? Modifier { get; set; }

    /// <summary>
    /// 逻辑删除:0=未删除,1=已删除 Default:0
    /// </summary>
    [SugarColumn(ColumnDescription = "软删除标记")]
    public virtual IsDelete IsDeleted { get; set; } = IsDelete.N;

    ///// <summary>
    ///// 
    ///// </summary>
    //public virtual void Create()
    //{
    //    var userId =currentUser.UserId;
    //    CreateTime = DateTime.Now;
    //    if (!string.IsNullOrEmpty(userId))
    //        Creator = long.Parse(userId);
    //}

    ///// <summary>
    ///// 
    ///// </summary>
    //public void Modify()
    //{
    //    var userId = currentUser.UserId;
    //    ModifyTime = DateTime.Now;
    //    if (!string.IsNullOrEmpty(userId))
    //        Modifier = long.Parse(userId);
    //}
}
